package day2;

/**
 * @author oldliu
 * @since 1.0
 */
public class Student {
    int math,chinese,english;
    public String name;
    //无参的构造方法
    public Student(){

    }
    public Student(String name){
        name=name;
    }
    //初始化姓名和语文成绩
    public Student(String name,int chinese){
//        this.name=name;
//        this.chinese=chinese;
        //必须是构造方法的第一行
        this(name,0,chinese,0);
        System.out.println("进入了两个参数的构造方法");
    }
//    //初始化姓名和数学
//    public Student(String name,int math){
//        this.name=name;
//        this.math=math;
//    }
    //变态
//    public void Student(String name,int math){
//        this.name=name;
//        this.math=math;
//    }
    //初始化姓名和英语
    public Student(int eng,String name){
        this.name=name;
        this.english=eng;
    }
    public Student(String n,int math,int chinese,int english){
        System.out.println("进入了4个参数的构造方法！");
        this.name=n;
        this.math=math;
        this.chinese=chinese;
        this.english=english;
    }
    public void show(){
        System.out.println("这个学生名叫"+name+",语文："+chinese+",数学："+math+",英语："+english);

    }
}
